package com.txh.blog.service.Impl;

import com.txh.blog.bean.User;
import com.txh.blog.dao.UserDao;
import com.txh.blog.service.UserService;
import com.txh.blog.util.MD5Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService{
    @Autowired
    private UserDao userDao;
    @Override
    public List<User> findAll() {
        return userDao.findAll();
    }

    @Override
    public User login(String username, String password) {
        return userDao.login(username, MD5Utils.code(password));
    }

    @Override
    public User findByUsername(String username) {
        return userDao.findByUsername(username);
    }
}
